package name.bingo.RedPacketTest;/**
 * create by yanbing on 2018/9/5 15:39
 */

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 *
 * @param:
 * @return:
 * @auther: yanbing
 * @date: 2018/9/5 15:40
 **/
@Configuration
public class FourThread {

    @Bean
    public ExecutorService getThreadPool(){
        //return Executors.newFixedThreadPool(10);//创建一个定长线程池，可控制线程最大并发数，超出的线程会在队列中等待
        return Executors.newCachedThreadPool();//创建一个可缓存线程池，如果线程池长度超过处理需要，可灵活回收空闲线程，若无可回收，则新建线程,线程池为无限大
        //return Executors.newScheduledThreadPool(5);
        //return Executors.newSingleThreadExecutor();
    }
}
